def binarysearch(a, b, func, eps, p = 0.5):
    c = a+(b-a)*p
    if abs(a-b) < eps:
        return c
    else:
        if func(a) > func(b):
            return binarysearch(c, b, func, eps, p = 0.5)
        else:
            return binarysearch(a, c, func, eps, p = 0.5)


import sys
sys.setrecursionlimit(1000)
result = binarysearch(a = -3,b = 5,func = lambda t: t*(t - 3), eps = 0.001)
print(result)
